package com.study.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the category database table.
 * 
 */
@Entity
@NamedQuery(name="Category.findAll", query="SELECT c FROM Category c")
public class Category implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="cat_id")
	private int catId;

	@Column(name="cat_name")
	private String catName;

	private int pid;
	
	private int catdel;

	//bi-directional many-to-one association to Good
	@OneToMany(mappedBy="category")
	private List<Good> goods;

	public Category() {
	}
	
	public void setCatdel(int catdel) {
		this.catdel = catdel;
	}
	public int getCatdel() {
		return catdel;
	}

	public int getCatId() {
		return this.catId;
	}

	public void setCatId(int catId) {
		this.catId = catId;
	}

	public String getCatName() {
		return this.catName;
	}

	public void setCatName(String catName) {
		this.catName = catName;
	}

	public int getPid() {
		return this.pid;
	}

	public void setPid(int pid) {
		this.pid = pid;
	}

	public List<Good> getGoods() {
		return this.goods;
	}

	public void setGoods(List<Good> goods) {
		this.goods = goods;
	}

	public Good addGood(Good good) {
		getGoods().add(good);
		good.setCategory(this);

		return good;
	}

	public Good removeGood(Good good) {
		getGoods().remove(good);
		good.setCategory(null);

		return good;
	}

}